<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>


<!DOCTYPE html>
<html lang="en">

<head>


    <title>访客登记</title>
    <!-- 引入 -->
    <script src="//g.alicdn.com/dingding/dingtalk-jsapi/2.6.41/dingtalk.open.js"></script>
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <script src="../static/js/myjs/domain.js"></script>
    <script>
        window.onload=function() {
            //var domain = "http://redlp.vaiwan.com/solareast-dingtalk/";
            //var domain = "http://bi.solareast.com/solareast-dingtalk/";
            //alert(domain);
            //var domain = "http://dingtalk.solareast.com/solareast-dingtalk/";
            dd.runtime.permission.requestAuthCode({
                corpId: "dingd70f5e7c628d97c835c2f4657eb6378f",
                onSuccess: function(result) {
                	//alert(result.code);

                	var url = domain + 'visitor/indexlogin.do';
                	 var id = '${id}';
                	 $.ajax({
                         url : url,
                         type : 'post',
                         //dataType:"json",
                         data: {authCode :result.code},
                            success:function(mydata)
                            {
                            	//alert("res = "+mydata);
                            	if(mydata.substring(0,5) == 'error'){
                            
                            		alert(mydata+'！请联系管理员(刘勇雷)');
                            	}else{
                            		window.location.href = domain+'visitor/check.do?id='+id;
                            	}
                            	
                            },
                            error:function(XMLHttpRequest, textStatus, errorThrown){      
                            	alert("网络通信错误:" + XMLHttpRequest.status);
                            	//alert(XMLHttpRequest.readyState);
                            	//alert(textStatus);
                            }
                     });
                	 

                },
                onFail : function(err) {}
             
            })

        };
    </script>
</head>
<body>
</body>
</html>